function Remove-SendPorts ($server, [xml]$xmlBindings)
{
	$sndItems = get-wmiobject -class "MSBTS_SendPort" -namespace "root\MicrosoftBizTalkServer" -computername $server
	foreach( $port in $xmlBindings.BindingInfo.SendPortCollection.SendPort )
	{
		foreach ($objItem in $sndItems)
		{
			if ( $objItem -ne $null)
			{
				if ( $port.Name -eq $objItem.Name )
				{
					$msg = "Removing $($objItem.Name)"
					if (Should-Process $msg ([REF]$AllAnswer) "" -Verbose:$Verbose -Confirm:$Confirm -Whatif:$Whatif)
					{
						log-message $msg -fore green
						$objItem.UnEnlist()
						$objItem.Delete()
					}
				}
			}
		}
	}
}

function Remove-RecievePorts($server, [xml]$xmlBindings)
{
	$rcvItems = get-wmiobject -class "MSBTS_ReceivePort" -namespace "root\MicrosoftBizTalkServer" -computername $server
	foreach( $port in $xmlBindings.BindingInfo.ReceivePortCollection.ReceivePort )
	{
		foreach ($objItem in $rcvItems) 
		{
			if ( $objItem -ne $null )
			{
				if ( $port.Name -eq $objItem.Name )
				{
					$msg = "Removing $($objItem.Name)"
					if (Should-Process $msg ([REF]$AllAnswer) "" -Verbose:$Verbose -Confirm:$Confirm -Whatif:$Whatif)
					{
						log-message $msg -fore green
						$objItem.Delete()
					}
				}
			}
		}
	}
}